﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using RestUpMVC.Resource;
using RestUpMVC.Test.TestClasses;

namespace RestUpMVC.Test.Resource
{
    [TestClass]
    public class ResourceNameResolverTest
    {
        [TestMethod]
        public void ResolveMetaData_ShouldReturnTheResourceNameFromTheResourceTypeName()
        {
            var resourceNameResolver = new ResourceNameResolver();
            var metaData = new ResourceMetaData();
            resourceNameResolver.ResolveMetaData(typeof(TestResource), metaData);

            Assert.AreEqual("TestResource", metaData.Name);
        }

        [TestMethod]
        public void ResolveMetaData_ShouldReturnTheResourceNameFromTheResourceNameAttributeValue()
        {
            var resourceNameResolver = new ResourceNameResolver();
            var metaData = new ResourceMetaData();
            resourceNameResolver.ResolveMetaData(typeof(ParentResource), metaData);

            Assert.AreEqual("resourcenameattribute", metaData.Name);
        }
    }

    
}